﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;


namespace Gin.Controls
{

    public abstract class UserInputControl
    {
        [XmlIgnore]
        public int Height { get; set; }
        public string ResultName { get; set; }

        public abstract Control Create(int containerWidth);
        public abstract object ReadValue(Control control);


        protected string ReadTextBoxDefault(Control control, string ControlTag)
        {
            string text = null;
            foreach (Control subControl in control.Controls)
            {
                if ((subControl is TextBox) && ((string)subControl.Tag == ControlTag))
                {
                    text = ((TextBox)subControl).Text;
                    return text;
                }
            }
            throw new Exception("Невозможно прочитать значение");
            return text;
        }
    }

}